package com.raptor.trustworthy.server.listeners;


import com.raptor.trustworthy.server.service.Gogogo;
import com.raptor.trustworthy.server.service.Impl.GogogoImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.ContextClosedEvent;


/**
 * @author jack
 * @since 1.0
 */
public class AppCloseListener implements ApplicationListener<ContextClosedEvent> {

  private static final Logger log = LoggerFactory.getLogger(AppCloseListener.class);


  @Override
  public void onApplicationEvent(ContextClosedEvent event) {
    log.info("diapatcher server closing.....");

    ConfigurableApplicationContext context = (ConfigurableApplicationContext) event
        .getApplicationContext();

    Gogogo gogogo = new GogogoImpl();
    gogogo.goTrue();

    log.info("diapatcher [{}] server closed","123");


  }



}
